<template>
    <div class="sidebarDiv tuijian" v-if="hotRankMemberData.length > 0" style="border-radius: 3px; ">
      <h2 class="hometitle">点击排行</h2>
      <ul class="tjpic" v-if="hotRankMemberData[0]">

        <a :href="hotRankMemberData[0].type == 0 ? VUE_DIDIOK_WEB + '/info/'+hotRankMemberData[0].oid : hotRankMemberData[0].outsideLink" target="_blank">
          <i>
            <img style="cursor:pointer" v-if="hotRankMemberData[0].photoList" v-lazy="hotRankMemberData[0].photoList[0]" :key="hotRankMemberData[0].photoList[0]">
          </i>
          <p>{{hotRankMemberData[0].title}}</p>
        </a>
      </ul>
      <ul class="sidenews">
        <li v-for="(item, index) in sideNews" v-if="index != 0" :key="item.uid">
          <a :href="item.type == 0 ? VUE_DIDIOK_WEB + '/info/'+item.oid : item.outsideLink" target="_blank">
            <i>
              <img style="cursor:pointer" v-if="item.photoList" v-lazy="item.photoList[0]" :key="item.photoList[0]" >
            </i>
            <p>{{item.title}}</p>
            <span>{{item.createTime}}</span>
          </a>
        </li>
      </ul>
    </div>
</template>

<script>
import { getHotRankMember } from "../../api/index";
import {getRankMemberByUid} from "../../api/blogContent";
export default {
  name: "TagCloud",
  data() {
    return {
      VUE_DIDIOK_WEB: process.env.VUE_DIDIOK_WEB,
      hotRankMemberData: [] //热门博客列表
    };
  },
  created() {
    getHotRankMember().then(response => {
      if (response.code == this.$ECode.SUCCESS) {
        this.hotRankMemberData = response.data.records;
      }
    });
  },
  computed: {
    //添加一个计算属性用于简单过滤掉数组中第一个数据
    sideNews() {
      return this.hotRankMemberData.filter(rankMember =>
        this.hotRankMemberData.indexOf(rankMember) != 0
      )
    }
  },
  methods: {

  }
};
</script>

<style>

</style>
